package com.jun.basic.config;

import com.jun.basic.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器啥的
 * 不依赖容器
 */
@Configuration
public class CustomerWebMvcConfigurer implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getLoginInterceptor()).addPathPatterns("/api/v1/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }

    public LoginInterceptor getLoginInterceptor() {
        return new LoginInterceptor();
    }
}
